<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id='test'></div>
    <div id='demo'></div>
    <script src="./js/react.development.js"></script>
     <script src="./js/react-dom.development.js"></script>
     <script src="./js/babel.min.js"></script>
    <script type="text/babel" >
        // 函数式组件
        // 由于没有实例对象 函数组件只能使用 props 没有 state refs
        function Demo(){
            // 此处的this 是undifand 因为babel 开启了严格模式
            return <h2>我是用函数定义的组件（较为简单的组件）</h2>
        }

        function Demos(props) {
            const {name,age,sex} = props
            return (
                <div>
                    <div>{name}</div>    
                    <div>{age}</div>
                    <div>{sex}</div>
                </div>
            )
        }

        // 渲染组件
        ReactDOM.render(<Demo/>, document.querySelector('#test'))
        ReactDOM.render(<Demos name='老王' age={11} sex='男' />, document.querySelector('#demo') )
    </script>
</body>
</html>